/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package modelo;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Diana
 */
@Entity
@Table(name = "deuda", catalog = "nomina", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Deuda.findAll", query = "SELECT d FROM Deuda d"),
    @NamedQuery(name = "Deuda.findByIddeuda", query = "SELECT d FROM Deuda d WHERE d.iddeuda = :iddeuda"),
    @NamedQuery(name = "Deuda.findByDeudaTotal", query = "SELECT d FROM Deuda d WHERE d.deudaTotal = :deudaTotal"),
    @NamedQuery(name = "Deuda.findByNumeroCuotas", query = "SELECT d FROM Deuda d WHERE d.numeroCuotas = :numeroCuotas"),
    @NamedQuery(name = "Deuda.findByEstado", query = "SELECT d FROM Deuda d WHERE d.estado = :estado")})
public class Deuda implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "iddeuda")
    private Integer iddeuda;
    @Basic(optional = false)
    @Column(name = "deudaTotal")
    private float deudaTotal;
    @Basic(optional = false)
    @Column(name = "numeroCuotas")
    private int numeroCuotas;
    @Basic(optional = false)
    @Column(name = "estado")
    private String estado;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "deudaIddeuda")
    private List<Libranza> libranzaList;
    @JoinColumn(name = "empleado_idempleado", referencedColumnName = "idempleado")
    @ManyToOne(optional = false)
    private Empleado empleadoIdempleado;
    @JoinColumn(name = "banco_idbanco", referencedColumnName = "idbanco")
    @ManyToOne(optional = false)
    private Banco bancoIdbanco;

    public Deuda() {
    }

    public Deuda(Integer iddeuda) {
        this.iddeuda = iddeuda;
    }

    public Deuda(Integer iddeuda, float deudaTotal, int numeroCuotas, String estado) {
        this.iddeuda = iddeuda;
        this.deudaTotal = deudaTotal;
        this.numeroCuotas = numeroCuotas;
        this.estado = estado;
    }

    public Integer getIddeuda() {
        return iddeuda;
    }

    public void setIddeuda(Integer iddeuda) {
        this.iddeuda = iddeuda;
    }

    public float getDeudaTotal() {
        return deudaTotal;
    }

    public void setDeudaTotal(float deudaTotal) {
        this.deudaTotal = deudaTotal;
    }

    public int getNumeroCuotas() {
        return numeroCuotas;
    }

    public void setNumeroCuotas(int numeroCuotas) {
        this.numeroCuotas = numeroCuotas;
    }

    public String getEstado() {
        return estado;
    }

    public void setEstado(String estado) {
        this.estado = estado;
    }

    @XmlTransient
    public List<Libranza> getLibranzaList() {
        return libranzaList;
    }

    public void setLibranzaList(List<Libranza> libranzaList) {
        this.libranzaList = libranzaList;
    }

    public Empleado getEmpleadoIdempleado() {
        return empleadoIdempleado;
    }

    public void setEmpleadoIdempleado(Empleado empleadoIdempleado) {
        this.empleadoIdempleado = empleadoIdempleado;
    }

    public Banco getBancoIdbanco() {
        return bancoIdbanco;
    }

    public void setBancoIdbanco(Banco bancoIdbanco) {
        this.bancoIdbanco = bancoIdbanco;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (iddeuda != null ? iddeuda.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Deuda)) {
            return false;
        }
        Deuda other = (Deuda) object;
        if ((this.iddeuda == null && other.iddeuda != null) || (this.iddeuda != null && !this.iddeuda.equals(other.iddeuda))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "modelo.Deuda[ iddeuda=" + iddeuda + " ]";
    }
    
}
